/**
 * Copyright 2011 Poltman.Ltd; www.poltman.com. All rights reserved.		
 *
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.db.service.dspace.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.poltman.dscentral.db.entity.dspace.ResourcepolicyEntity;
import com.poltman.dscentral.db.exceptions.RepositoryAccessException;
import com.poltman.dscentral.db.exceptions.RepositoryException;
import com.poltman.dscentral.db.repository.dspace.ResourcepolicyRepository;
import com.poltman.dscentral.db.service.dspace.ResourcepolicyService;

/**
 * 
 * @author z.ciok@poltman.com
 *
 */
@Repository
@Service("resourcepolicyService")
public class ResourcepolicyServiceImpl implements ResourcepolicyService {
	private static Logger log = Logger.getLogger(ResourcepolicyServiceImpl.class);
	
	@Autowired
	private ResourcepolicyRepository resourcepolicyRepository;

	@Transactional
	@Override
	public List<ResourcepolicyEntity> findByResourceTypeIdAndResourceIdAndActionId(Integer ResourceTypeId, Integer resourceId, Integer actionId) throws RepositoryAccessException, RepositoryException {
	return resourcepolicyRepository.findByResourceTypeIdAndResourceIdAndActionId(ResourceTypeId, resourceId, actionId);
	}

	@Transactional
	@Override
	public ResourcepolicyEntity save(ResourcepolicyEntity resourcepolicyEntity) throws RepositoryAccessException, RepositoryException {
		return resourcepolicyRepository.save(resourcepolicyEntity);
	}
}
